
<!-- 修改角色弹框 -->
<template>
  <div>
    <el-dialog
      title="修改角色"
      :visible.sync="dialogVisible"
      width="30%"
      :before-close="handleClose"
      style="margin-top: 15vw"
    >
      <span>
        <el-form ref="form" :model="form" label-width="80px">
          <el-form-item label="选择角色">
            <el-select v-model="form.user" placeholder="请选择">
              <el-option label="一处" value="shanghai"></el-option>
              <el-option label="二处" value="beijing"></el-option>
            </el-select>
          </el-form-item>
        </el-form>
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="onSubmit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
  
  <!-- <script>
import { updateUserSetRole } from "@/api/datacentersg/achives/documentApi";
export default {
  data() {
    return {
      dialogVisible: false,
      form: {
        user: "",
      },
      row: [],
    };
  },
  methods: {
    initUserPop(row) {
      console.log(row,"row");
      this.row = row;
      this.dialogVisible = true;
      this.form.user = row[0].user
    },
    handleClose(done) {
      done();
    },
    onSubmit() {
      const params = [];

      if (this.row.length > 1) {
        this.row.forEach((item) => {
          params.push({
            userId: item.userId,
            roleId: item.roleId,
          });
        });
      } else if (this.row.length == 1) {
        params.push({
          userId: this.row[0].userId,
          roleId: this.row[0].roleId,

        });
      }

      updateUserSetRole(params).then((result) => {
        if (result.code == 0) {
          this.$message({
            message: "操作成功",
            type: "success",
          });
          this.$emit("initData");
          this.dialogVisible = false;
        }
      });
    },
  },
};
</script> -->
  
  <style>
</style>